var values = require("postcss-modules-values");
var webpack = require('webpack');
var path = require('path');

const ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = {
    entry: path.resolve(__dirname, "index.js"),
    output: {
        path: path.resolve(__dirname, "public"),
        filename: "[name].bundle.js"
    },
    module: {
        loaders: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'babel-loader'
            },
            {
                test: /\.css$/,
                loader: ExtractTextPlugin.extract({
                    fallback: 'style-loader',
                    use: ['css-loader?modules', 'postcss-loader']
                })
            },
            // {
            //    test: /\.css$/,
            //    loader: "style-loader!css-loader?modules!postcss-loader"
            // }
        ]
    },
    plugins: [
        new webpack.LoaderOptionsPlugin({
            test: /\.css$/,
            options: {
                postcss: [values]
            }
        }),
        new ExtractTextPlugin({filename: '[name].bundle.css', disable: false})
    ]
};